home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 1680 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: ecf2.puc.edu!bivey
  2. From: bivey@ecf2.puc.edu (Bruce Ivey)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: swap high and low 16 bits?
  5. Date: 16 Jan 1996 05:55:36 GMT
  6. Organization: CRL Dialup Internet Access
  7. Message-ID: <4dfeko$phv@nntp.crl.com>
  8. References: <Pine.OSF.3.91.960115174921.19742A-100000@io.UWinnipeg.ca>
  9. NNTP-Posting-Host: ecf2.puc.edu
  10.  
  11. Bill Simpson (wsimpson@uwinnipeg.ca) wrote:
  12. : I wanted to obtain a "random" starting number each time a program
  13. : is run.  The obvious choice is time(NULL).  The problem with it is that
  14. : if the program runs and terminates fairly quickly, the number returned by 
  15. : time(NULL) is quite similar each run, differing only by the lowest bits.
  16.  
  17. Why not use a combination of values obtained from your system's time of day
  18. instead of the time the program has been running?  Unless the program is
  19. set to run at the same time every day, this should give good seeds.
  20.  
  21.  
  22. -----------------------------------------------------------------------------
  23. Bruce Ivey         Dept of Physics & Computer Science   Pacific Union College
  24. Angwin, CA 94508            bivey@puc.edu                      (707) 965-7269
  25. =============================================================================
  26.